net/sched: taprio: always validate TCA_TAPRIO_ATTR_PRIOMAP
authorEric Dumazet <edumazet@google.com>
Tue, 4 Jun 2024 18:15:11 +0000 (18:15 +0000)
committerSalvatore Bonaccorso <carnil@debian.org>
Fri, 21 Jun 2024 03:59:28 +0000 (05:59 +0200)
commit4c624fd8a66e90babfb5e5a1fa8b2dffd22f8b23
tree06e49307c59c13822da5fafc5ae3794ee05429c2
parent0d1770ded26632e26dbe5ffbbcbb3b619594e7bd
net/sched: taprio: always validate TCA_TAPRIO_ATTR_PRIOMAP

Origin: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/commit?id=3e102bb4e13ae49c014096f149ed0c8430e3c1f0
Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2024-36974

[ Upstream commit f921a58ae20852d188f70842431ce6519c4fdc36 ]

If one TCA_TAPRIO_ATTR_PRIOMAP attribute has been provided,
taprio_parse_mqprio_opt() must validate it, or userspace
can inject arbitrary data to the kernel, the second time
taprio_change() is called.

First call (with valid attributes) sets dev->num_tc
to a non zero value.

Second call (with arbitrary mqprio attributes)
returns early from taprio_parse_mqprio_opt()
and bad things can happen.

Fixes: a3d43c0d56f1 ("taprio: Add support adding an admin schedule")
Reported-by: Noam Rathaus <noamr@ssd-disclosure.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://lore.kernel.org/r/20240604181511.769870-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Gbp-Pq: Topic bugfix/all
Gbp-Pq: Name net-sched-taprio-always-validate-TCA_TAPRIO_ATTR_PRI.patch
net/sched/sch_taprio.c